
import Foundation

import UIKit

class EulaViewController: UIViewController {
    
    @IBOutlet weak var readBtn: UIButton!
    @IBOutlet weak var doneBtn: UIButton!
    @IBOutlet weak var Agree: UIButton!
    @IBOutlet weak var backVIew: UIView!
    @IBOutlet weak var contentView: UITextView!
    typealias submitBlock = ()->Void
    var callBlock:submitBlock?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.backVIew.setAllCorners(corner: 30)
        self.contentView.layer.masksToBounds = true
        self.contentView.layer.cornerRadius = 12
        self.Agree.layer.masksToBounds = true
        self.Agree.layer.cornerRadius = 23
    }
    
    func callBackBlock(_ block: @escaping submitBlock) { 
        callBlock = block
    }
    
    @IBAction func agreedBtn(_ sender: UIButton) {
        sender.isSelected = !sender.isSelected
    }
    
    @IBAction func agreeAction(_ sender: Any) {
        self.dismiss(animated: false) { [self] in
            if callBlock != nil
            {
                callBlock!()
            }
        }
    }
    
}
